package operation;
import book.Book;
import book.BookList;
import java.util.Scanner;

public class FindOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        int size=bookList.getUseSize();
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你要查询的书名");
        String name=scanner.nextLine();
        for (int i = 0; i < size; i++) {
            Book book = bookList.getbook(i);
            if(book.getName().equals(name)){
                System.out.println("找到这本书，信息如下");
                System.out.println(book);
                return;
            }
        }
        System.out.println("查无此书");
    }
}
